<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 需求: 每次打开网页, 背景色随机一个颜色
        // 1. 颜色数组
        let colorArr = ['red', 'blue', 'pink', 'orange']
        // 2. 随机数
        let randNum = Math.floor(Math.random() * (3 - 0 + 1) + 0)
        // 3. 随机数去颜色数组换出对应颜色字母 colorArr[randNum]
        // 4. 颜色设置给body
        document.body.style.backgroundColor = colorArr[randNum]
    </script>
</body>
</html>